package com.jy.rhin.domain.exception;

import com.jy.framework.base.exception.BaseException;
import com.jy.framework.base.exception.ErrorType;

public class ListenerException extends BaseException {

    public ListenerException(ErrorType errorType) {
        super(errorType, errorType.getMsg());
    }

    public ListenerException(Error processerError, Exception e) {
        super(processerError, processerError.getMsg(), e);
    }

    public enum Error implements ErrorType {
        /**
         * 处理过程所有错误
         */
        LISTENER_MSG_FORMAT_ERROR("LISTENER_MSG_FORMAT", "消息格式化错误"),
        LISTENER_MSG_CONTENT_NULL("LISTENER_MSG_CONTENT_NULL", "消息内容缺失"),
        LISTENER_RECEIVE_TOPIC_NOT_FOUND("LISTENER_RECEIVE_TOPIC_NOT_FOUND", "消息主题表达式缺失"),
        ;
        String code;
        String msg;



        Error(String code, String msg) {
            this.code = code;
            this.msg = msg;
        }

        @Override
        public String getCode() {
            return code;
        }

        @Override
        public String getMsg() {
            return msg;
        }
    }
}
